package com.smedi.ismedi.authoritymanagement.api.feign;

import com.smedi.ismedi.authoritymanagement.api.dto.request.*;
import com.smedi.ismedi.authoritymanagement.api.dto.response.*;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-7-15 15:46
 */
@Api(tags = {"权限管理角色配置接口"})
@FeignClient(name = "ismedi-authority-management")
@RequestMapping(value = "/api/v1/authority/role/management")
public interface RemoteAuthorityRoleManagementFeignApi {
    /**
     * 保存角色信息
     *
     * @param roleBasicRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存角色信息")
    @PostMapping(value = "/saveRoleBasic")
    ResponseData<RoleBasicResponse> postSaveRoleBasic(@Validated @RequestBody RoleBasicRequest roleBasicRequest);

    /**
     * 批量保存角色信息
     *
     * @param roleBasicRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "批量保存角色信息")
    @PostMapping(value = "/batchSaveRoleBasic")
    ResponseData<List<RoleBasicResponse>> postBatchSaveRoleBasic(@Validated @RequestBody List<RoleBasicRequest> roleBasicRequest);

    /**
     * 删除角色信息
     *
     * @param roleId
     * @return
     */
    @ApiOperation(httpMethod = "DELETE", value = "删除角色信息")
    @DeleteMapping(value = "/deleteRoleBasic")
    ResponseData<Boolean> deleteRoleBasic(@RequestParam("roleId") Long roleId);

    /**
     * 批量删除角色信息
     *
     * @param roleIds
     * @return
     */
    @ApiOperation(httpMethod = "DELETE", value = "批量删除角色信息")
    @DeleteMapping(value = "/batchDeleteRoleBasics")
    ResponseData<Boolean> deleteBatchDeleteRoleBasics(@RequestParam("roleIds") List<Long> roleIds);

    /**
     * 角色设置界面查询分页
     *
     * @param offset
     * @param pageSize
     * @param roleName
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "角色设置界面查询分页")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "offset", value = "页码", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(paramType = "query", name = "pageSize", value = "每页行数", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(paramType = "query", name = "roleName", value = "角色名称", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "query", name = "roleType", value = "角色分类", dataType = "String", dataTypeClass = String.class)
    })
    @GetMapping(value = "/queryRoleBasicPagination")
    ResponseData<PaginationData<RoleBasicResponse>> getQueryRoleBasicPagination(@RequestParam("offset") Long offset,
                                                                                @RequestParam("pageSize") Long pageSize,
                                                                                @RequestParam(value = "roleName", required = false) String roleName,
                                                                                @RequestParam(value = "roleType", required = false) String roleType);

    /**
     * 根据人员id获取所有角色
     *
     * @param personId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据人员id获取所有角色")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personId", value = "人员id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/getQueryRolesByPersonId")
    ResponseData<List<RoleBasicResponse>> getQueryRolesByPersonId(@RequestParam("personId") Long personId);

    /**
     * 批量保存角色分配
     *
     * @param oneRoleMultiPersonRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "批量保存角色分配")
    @PostMapping(value = "/postBatchSaveOneRoleForMultiPerson")
    ResponseData<Boolean> postBatchSaveOneRoleForMultiPerson(@RequestBody OneRoleMultiPersonRequest oneRoleMultiPersonRequest);

    /**
     * 为一个人添加多个角色信息9
     *
     * @param multiRoleOnePersonRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "为一个人添加多个角色信息")
    @PostMapping(value = "/postBatchSaveMultiRoleForOnePerson")
    ResponseData<Boolean> postBatchSaveMultiRoleForOnePerson(@RequestBody MultiRoleOnePersonRequest multiRoleOnePersonRequest);

    /**
     * 删除角色成员信息
     *
     * @param roleMemberId
     * @return
     */
    @ApiOperation(httpMethod = "DELETE", value = "删除角色成员信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "roleMemberId", value = "角色分配id", dataType = "Long", dataTypeClass = Long.class)
    })
    @DeleteMapping(value = "/deleteRoleMember")
    ResponseData<Boolean> deleteRoleMember(@RequestParam("roleMemberId") Long roleMemberId);

    /**
     * 角色分配界面查询分页
     *
     * @param offset
     * @param pageSize
     * @param lastName
     * @param userName
     * @param mobile
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "角色分配界面查询分页")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "offset", value = "页码", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(paramType = "query", name = "pageSize", value = "每页行数", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(paramType = "query", name = "roleId", value = "角色id", dataType = "Long", dataTypeClass = Long.class),
            @ApiImplicitParam(paramType = "query", name = "lastName", value = "姓名", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "query", name = "userName", value = "用户名", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "query", name = "mobile", value = "手机号", dataType = "String", dataTypeClass = String.class),


    })
    @GetMapping(value = "/queryRoleMemberPagination")
    ResponseData<PaginationData<RoleMemberResponse>> getQueryRoleMemberPagination(@RequestParam("offset") Long offset,
                                                                                  @RequestParam("pageSize") Long pageSize,
                                                                                  @RequestParam(value = "roleId") Long roleId,
                                                                                  @RequestParam(value = "lastName", required = false) String lastName,
                                                                                  @RequestParam(value = "userName", required = false) String userName,
                                                                                  @RequestParam(value = "mobile", required = false) String mobile);

    /**
     * 传入人员id获取与角色的关系
     *
     * @param personIds
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "传入人员id获取与角色的关系")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personIds", value = "人员id数组", dataType = "List", dataTypeClass = List.class),
            @ApiImplicitParam(paramType = "query", name = "roleId", value = "角色id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/queryPersonRoleRelationshipByPersonIds")
    ResponseData<List<PersonRoleRelationshipResponse>> getQueryPersonRoleRelationshipByPersonIds(@RequestParam("personIds") List<Long> personIds,
                                                                                                 @RequestParam("roleId") Long roleId);

    /**
     * 传入角色id获取到该角色下的所有人员id
     *
     * @param roleId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "传入角色id获取到该角色下的所有人员id")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "roleId", value = "角色id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/queryAllPersonIdsByRoleId")
    ResponseData<List<Long>> getQueryAllPersonIdsByRoleId(@RequestParam("roleId") Long roleId);

    /**
     * 传入角色ids获取到该角色下的所有人员id
     *
     * @param roleIds 角色列表
     * @return ResponseData<List<Long>>
     */
    @ApiOperation(httpMethod = "GET", value = "传入角色id获取到该角色下的所有人员id")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "roleIds", value = "角色ids", dataType = "List<Long>", dataTypeClass = List.class),
    })
    @GetMapping(value = "/getQueryAllPersonIdsByRoleIds")
    ResponseData<List<Long>> getQueryAllPersonIdsByRoleIds(@RequestParam("roleIds") List<Long> roleIds);


    /**
     * 批量保存角色有哪些功能组结构id
     *
     * @param rolePermissionDetailGroupRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "批量保存角色有哪些功能组结构id")
    @PostMapping(value = "/batchSaveRolePermissionDetails")
    ResponseData<Boolean> postBatchSaveRolePermissionDetails(@Validated @RequestBody RolePermissionDetailGroupRequest rolePermissionDetailGroupRequest);

    /**
     * 传入角色名称与角色名称一致的角色
     *
     * @param roleName
     * @param fuzzy
     * @param showPersonId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "传入角色名称与角色名称一致的角色")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "roleName", value = "角色名称", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(paramType = "query", name = "fuzzy", value = "模糊匹配", dataType = "boolean", dataTypeClass = boolean.class),
            @ApiImplicitParam(paramType = "query", name = "showPersonId", value = "显示人员id", dataType = "boolean", dataTypeClass = boolean.class)
    })
    @GetMapping(value = "/queryRoleByRoleName")
    ResponseData<List<RoleBasicResponse>> getQueryAllPersonIdsByRoleId(@RequestParam("roleName") String roleName,
                                                                       @RequestParam("fuzzy") boolean fuzzy,
                                                                       @RequestParam("showPersonId") boolean showPersonId);

    /**
     * 获取 角色 列表
     *
     * @param roleListQueryRequest  角色 列表 请求
     * @return ResponseData<List<RoleResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "获取 角色 列表")
    @PostMapping(value = "/role/list")
    ResponseData<List<RoleResponse>> getRoleList(@RequestBody RoleListQueryRequest roleListQueryRequest);

    /**
     * 获取 角色 列表（不带token）
     *
     * @param roleListQueryRequest  角色 列表 请求
     * @return ResponseData<List<RoleResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "获取 角色 列表（不带token）")
    @PostMapping(value = "/role/list/no-token")
    ResponseData<List<RoleResponse>> getRoleListWithoutToken(@RequestBody RoleListQueryRequest roleListQueryRequest);

    /**
     * 获取 角色分配 列表
     *
     * @param roleAssignmentListQueryRequest 角色分配  列表 请求
     * @return ResponseData<List<RoleAssignmentResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "获取 角色分配 列表")
    @PostMapping(value = "/role-assignment/list")
    ResponseData<List<RoleAssignmentResponse>> getRoleAssignmentList(@RequestBody RoleAssignmentListQueryRequest roleAssignmentListQueryRequest);

    /**
     * 获取 角色分配 列表（不带token）
     *
     * @param roleAssignmentListQueryRequest 角色分配  列表 请求
     * @return ResponseData<List<RoleAssignmentResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "获取 角色分配 列表（不带token）")
    @PostMapping(value = "/role-assignment/list/no-token")
    ResponseData<List<RoleAssignmentResponse>> getRoleAssignmentListWithoutToken(@RequestBody RoleAssignmentListQueryRequest roleAssignmentListQueryRequest);
}
